TimeDate
 
 
 Bean TimeDate
 
Time and date

Typical usage of the bean in user's code.

Typical Usage:

Required bean name is "TmDt1".

(1)
There is current time and date read from the bean in this example:

 MAIN.C
 
void main(void)
{
  TIMEREC Time;
  DATEREC Date;
  
  TmDt1_GetTime( &Time );
  TmDt1_GetDate( &Date );

}

(2)
There is alarm used in the following example:

 MAIN.C
 
extern int alarm;

void main(void)
{
  TIMEREC Time;
  
  TmDt1_GetTime( &Time ); /* get current time */
  
  /* set alarm one minute later */
  TmDt1_SetAlarm( Time.Hour, Time.Min+1, Time.Sec, Time.Sec100 );
  
  /* wait till the alarm event (alarm flag is set) */
  while( !alarm );
}

 EVENT.C

int alarm = 0;

void TmDt1_OnAlarm(void)
{
  alarm = 1; /* set alarm flag in the alarm event handler */
}

For more about typical usage of the bean code please refer to the page Bean Code Typical Usage.


Processor ExpertTM and Embedded BeansTM are registered trademarks of UNIS, Ltd.
©1997-2005, UNIS, Ltd.